
export default {
    canUndo: true,
    execute: (context, options, isUndo) => {
        const { sheet, row, col, id } = options;

        const cell = sheet.getCell(row, col);
        let fileList = cell.value();
        sheet.suspendPaint();
        try {
            if (isUndo) {
                const { fileList } = options.old;
                cell.value(fileList);
            } else {
                options.old = { fileList };
                const name = 'f,' + String(row) + ',' + String(col) + ',' + id;
                sheet.floatingObjects.remove(name);
                const newFileList = fileList.filter(obj => obj.fileid != id);
                cell.value(newFileList);
            }
        } catch (e) {
            if (!!(window.console && window.console.log)) {
                window.console.log(e);
            }
        }
        sheet.resumePaint();
    }

}